package mysql

import "gorm.io/gorm"

type Goods2 struct {
	gorm.Model
	UserId      int64   `gorm:"type:int(10);comment:用户id;"`
	GoodsTitle  string  `gorm:"type:varchar(30);comment:商品标题;"`
	GoodsPrice  float32 `gorm:"type:decimal(30);comment:商品价格;"`
	GoodsStock  int64   `gorm:"type:int(10);comment:商品库存;"`
	GoodsStatus int8    `gorm:"type:tinyint(1);comment:商品状态 1代表上架 0 代表下架;"`
	GoodsCover  string  `gorm:"type:varchar(255);comment:商品图片;"`
}

// 查询商品
func (g *Goods2) FindGoods(goodsId int) error {

	return DB.Where("id = ?", goodsId).Find(&g).Error

}
